package isquirrel.beans;

import java.util.HashSet;
import java.util.Set;
import isquirrel.semantic.DBpedia;

public class Interest implements Comparable<Interest>{
	
	private Long id;
	private String label;
	private String description;
	
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	private Set<String> subjects = new HashSet<String>();

	public Interest() {	
	}
	
	public Interest(String label) {
		this.label = label;
	}
	
	public Interest(String label, Set<String> subjects) {
		DBpedia db = new DBpedia();
		this.label = label;
		this.subjects = subjects;
		this.description = db.getDescription(label);
	}

	public Long getId() {
		return id;
	}

	@SuppressWarnings("unused")
	private void setId(Long id) {
		this.id = id;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public Set<String> getSubjects() {
		return subjects;
	}

	public void setSubjects(Set<String> subjects) {
		this.subjects = subjects;
	}

	@Override
	public boolean equals(Object other){
		if (other instanceof Interest) {
			return this.label.equals(((Interest) other).getLabel());
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return this.label.hashCode();
	}

	public int compareTo(Interest i) {
		if (this.label.equals(i.getLabel()))
			return 0;
		else if (this.label.toLowerCase().compareTo(i.getLabel().toLowerCase()) > 0)
			return 1;
		else 
			return -1;
	}
	
}
